#include "Game.h"
#include "XMLParser.h"



using namespace std;



/**
 * Loads all Map information for the game.
 * @see GetConfig::GetConfig()
 * @see GetConfig::addATTROption()
 * @see GetConfig::readClassConfigFile
 * @param void
 * @return void
 */
void Game::loadMapInformation()
{
	XMLParser appConfig(GAME_LOADCONFIG_MAP_ROOTELEM, GAME_LOADCONFIG_MAP_FIRSTELEM, GAME_LOADCONFIG_MAP_SECDELEM);

	loadTerrainInformation();
	appConfig.addATTROption(GAME_LOADCONFIG_MAP_ATTR1);
	appConfig.addATTROption(GAME_LOADCONFIG_MAP_ATTR2);
	appConfig.addATTROption(GAME_LOADCONFIG_MAP_ATTR3);
	appConfig.addATTROption(GAME_LOADCONFIG_MAP_ATTR4);
	appConfig.addATTROption(GAME_LOADCONFIG_MAP_ATTR5);
	appConfig.addATTROption(GAME_LOADCONFIG_MAP_ATTR6);
	appConfig.addATTROption(GAME_LOADCONFIG_MAP_ATTR7);
	appConfig.addATTROption(GAME_LOADCONFIG_MAP_ATTR8);
	appConfig.addATTROption(GAME_LOADCONFIG_MAP_ATTR9);
	appConfig.readMapConfigFile(GAME_LOADCONFIG_MAP_FILENAME, m_maps);
}


/**
 * Prints out information about all the Maps in the Game
 * @param void
 * @return void
 */
void Game::showMapInformation()
{
	for (unsigned int i = 0; i < m_maps.size(); ++i)
	{
		m_maps[i]->print();
	}
}


/**
 * check if there is at least one Map loaded and the first map is available
 * @param void
 * @return bool - false if no map is loaded
 */
bool Game::checkMapInformation()
{

	if ((m_maps.size() > 0) && (m_maps[0] != 0))
	{
		m_currentMap = m_maps[0];
		return true;
	}
	return false;

}